Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-7502: Added file size validation for image asset field type #320

Merged
merged 7 commits into from
Jan 16, 2024

Conversation

ciastektk
Copy link
Contributor

@ciastektk ciastektk commented Jan 10, 2024

Question Answer
JIRA issue IBX-7502
Type bug
Target Ibexa version v4.6
BC breaks no

Ref: ibexa/content-forms#61

This PR adds file size validation to image asset field type definition, base on validation settings from ezimage field type. Currently validation is added as Symfony File validator in: https://github.com/ibexa/content-forms/blob/main/src/lib/Form/Type/FieldType/ImageAssetFieldType.php#L82-L86.

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (main for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ibexa/engineering).

phpstan-baseline.neon Outdated Show resolved Hide resolved
@ciastektk ciastektk added Bug Something isn't working Ready for review labels Jan 10, 2024
@ciastektk ciastektk requested a review from a team January 10, 2024 11:18
@ciastektk ciastektk force-pushed the ibx-7502-added-file-size-validation-for-image-asset branch from ada6b9d to 12ddb47 Compare January 10, 2024 11:26
(int)$content->contentInfo->contentTypeId
);

if ($this->assetMapper->isAsset($content)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer an early return instead, if Content is not an asset and we cannot continue with validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed: 44d9fbb

tests/lib/FieldType/ImageAssetTest.php Outdated Show resolved Hide resolved
@konradoboza konradoboza requested a review from a team January 15, 2024 08:14
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@micszo micszo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA Approved on Ibexa Commerce 4.6.0-dev.

@micszo micszo removed their assignment Jan 16, 2024
@webhdx webhdx merged commit ed512f1 into main Jan 16, 2024
21 checks passed
@alongosz alongosz deleted the ibx-7502-added-file-size-validation-for-image-asset branch January 16, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working QA approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants